<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="打印表格(函数).js" type="text/javascript"></script>


</head>
<body>
    <ul id="parent">
        <li id="first">列表一</li>
        <li id="second">列表二</li>
        <li id="third">列表三</li>
        <li id="fifth">列表三</li>
    </ul>
    <script type="text/javascript">
        // hasChildNodes这个函数用来判断是否含有子节点，boolean类型
        var parents = document.getElementById("parent");
        var result = parents.hasChildNodes();
        if(parents){
            alert("含有子节点");
        }
    </script>

</body>
</html>